function res_ll = compute_pd_LL_RE(I)
% Compute log-linearized solution for the wealth-consumption ratio

% Set Options
options_fmincon = optimoptions('fmincon','Algorithm','sqp', 'MaxFunEvals', 100000,'MaxIter',200,'Display','iter','FinDiffType','central');

% Solve system of equations for mean wealth-consumption ratio
mean_pd_init = 6.5;
[mean_pd,~,Exitflag] = fmincon(@(x) 1,mean_pd_init,[],[],[],[],[],[],@(x) wrap_vec(mean_pd_LL_RE(x,I)),options_fmincon);

if Exitflag == 1
else
    error('Log-Linearization did not converge')
end

% Compute linearization parameters 
[~, res_ll.kappad_0, res_ll.kappad_1, res_ll.Ad_0, res_ll.Ad_2] = mean_pd_LL_RE(mean_pd,I);

end